package top.fyukina.fymil.elements;

import java.util.HashMap;
import java.util.Map;

public class ProgramPack {
    private final Map<String, Program> programs = new HashMap<>();
    private String mainProgramName;
    public void addProgram(Program program) {
        addProgram(program, false);
    }
    public void addProgram(Program program, boolean isMain) {
        programs.put(program.getName(), program);
        if (isMain) {
            mainProgramName = program.getName();
        }
    }
    public void setMain(String name) {
        if (programs.containsKey(name)) {
            mainProgramName = name;
        }
    }
    public Map<String, Program> getPrograms() {
        return programs;
    }
    public Program getMain() {
        return programs.get(mainProgramName);
    }
}